using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace OsdmSoftware.CommonLibrary
{
    public partial class InputForm: Form
    {
        public InputForm(string message, string caption, string initialValue)
        {
            InitializeComponent();
            this.Text = caption;
            label1.Text = message;
            textBox1.Text = initialValue;
            textBox1.SelectAll();
#if !PocketPC
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
#endif
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        public static string Ask(string message, string caption, string initialValue)
        {
            InputForm form = new InputForm(message, caption, initialValue);
#if !PocketPC
            form.ShowInTaskbar = false;
#endif
            string result = null;
            if (form.ShowDialog() == DialogResult.OK)
            {
                result = form.textBox1.Text;
            }
            form.Dispose();
            return result;
        }
    }
}